package com.soo.hoo.admin.component;

import com.soo.hoo.admin.service.PermissionService;
import com.soo.hoo.admin.service.UserService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

/**
 * <p>
 * 数据初始化组件
 * </p>
 *
 * @author 杨燚
 * @since 2022/11/28
 */
@Component
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class InitDataApplicationRunner implements ApplicationRunner {

    private final UserService userService;
    private final PermissionService permissionService;

    @Override
    public void run(ApplicationArguments args) throws Exception {
        userService.initUser();
        permissionService.initPermission();
    }
}
